﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Rainbow.model
{
    public class ConnectInfo
    {
        /// <summary>
        /// 名称
        /// </summary>
        public string name;
        /// <summary>
        /// 主机ip
        /// </summary>
        public string host;
        /// <summary>
        /// 端口号
        /// </summary>
        public int port;
        /// <summary>
        /// 用户名
        /// </summary>
        public string username;
        /// <summary>
        /// 密码
        /// </summary>
        public string passPhrase;
        /// <summary>
        /// 密钥文件路径或内容
        /// </summary>
        public string privateKeyFileName;

        public ConnectInfo() { 
            this.host = "";
            this.port = 22;
            this.username = "";
            this.passPhrase = "";
        }

        public ConnectInfo(ConnectInfo info)
        {
            this.name = info.name;
            this.host = info.host;
            this.port = info.port;
            this.username = info.username;
            this.passPhrase = info.passPhrase;
            this.privateKeyFileName = info.privateKeyFileName;
        }

        public ConnectInfo(ConnectInfoViewModel info)
        {
            this.name = info.name;
            this.host = info.host;
            this.port = info.port;
            this.username = info.username;
            this.passPhrase = info.passPhrase;
            this.privateKeyFileName = info.privateKeyFileName;
        }

        public void Copy(ConnectInfo info)
        {
            this.name = info.name;
            this.host = info.host;
            this.port = info.port;
            this.username = info.username;
            this.passPhrase = info.passPhrase;
            this.privateKeyFileName = info.privateKeyFileName;
        }

        public void Copy(ConnectInfoViewModel info)
        {
            this.name = info.name;
            this.host = info.host;
            this.port = info.port;
            this.username = info.username;
            this.passPhrase = info.passPhrase;
            this.privateKeyFileName = info.privateKeyFileName;
        }

        public ConnectInfo Clone()
        {
            return new ConnectInfo(this);
        }
    }
}
